package com.demo.core.listener.event;

import com.demo.core.enums.RedisCacheEnum;
import org.springframework.context.ApplicationEvent;

import java.io.Serializable;

/**
 * @author Tan-Bowen
 * @description TODO 清除缓存监听器
 * @date 2021/7/27 16:22
 */
public class ClearTableCacheEvent extends ApplicationEvent {

    private static final long serialVersionUID = 8742009454531972997L;
    private final Class<?> clz;

    private final Serializable id;

    public ClearTableCacheEvent(Object source,Class<?> clz,Serializable id) {
        super(source);
        this.clz = clz;
        this.id = id;
    }

    public String getKey(){
        return RedisCacheEnum.TABLE.createKey(clz.getSimpleName(),id);
    }
}
